package com.tbsoft.ehr.model;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class AttendanceReport {
	private String userId;
	private String userName;
	private String sex;
	private Date date;
	private String serviceName;
	private String adType;
	
	public synchronized String getAdType() {
		return adType;
	}
	public synchronized void setAdType(String adType) {
		this.adType = adType;
	}
	private int lateHits;
	private Map<String,BigDecimal> leaveMap= new HashMap<String,BigDecimal>();
	public synchronized void pubLevaeMap(String key,BigDecimal value){
		this.leaveMap.put(key, value);
	}
	public synchronized BigDecimal getLeaveValue(String key){
		BigDecimal tmp = this.leaveMap.get(key);
		if(tmp == null){
			tmp = new BigDecimal(0);
		}
		return tmp;
	}
	public synchronized BigDecimal getLeaveTotVaule(){
		BigDecimal tmp = new BigDecimal(0);
		for(Entry<String,BigDecimal> entry: leaveMap.entrySet()){
			tmp = tmp.add(entry.getValue());
		}
		return tmp;
	}
	public synchronized Map<String, BigDecimal> getLeaveMap() {
		return leaveMap;
	}
	public synchronized String getServiceName() {
		return serviceName;
	}
	public synchronized void setServiceName(String serviceName) {
		this.serviceName = serviceName;
	}
	private BigDecimal normalHours;
	private BigDecimal leaveHours;
	private BigDecimal payloadHours;
	public synchronized String getUserId() {
		return userId;
	}
	public synchronized void setUserId(String userId) {
		this.userId = userId;
	}
	public synchronized String getUserName() {
		return userName;
	}
	public synchronized void setUserName(String userName) {
		this.userName = userName;
	}
	public synchronized Date getDate() {
		return date;
	}
	public synchronized void setDate(Date date) {
		this.date = date;
	}
	public synchronized BigDecimal getNormalHours() {
		if(normalHours == null){
			normalHours = new BigDecimal(0);
		}
		return normalHours;
	}
	public synchronized void setNormalHours(BigDecimal normalHours) {
		this.normalHours = normalHours;
	}
	
	
	public synchronized BigDecimal getLeaveHours() {
		if(leaveHours == null){
			leaveHours = new BigDecimal(0);
		}
		return leaveHours;
	}
	public synchronized void setLeaveHours(BigDecimal leaveHours) {
		this.leaveHours = leaveHours;
	}
	public synchronized BigDecimal getPayloadHours() {
		if(payloadHours == null){
			payloadHours = new BigDecimal(0);
		}
		return payloadHours;
	}
	public synchronized void setPayloadHours(BigDecimal payloadHours) {
		this.payloadHours = payloadHours;
	}
	public synchronized String getSex() {
		return sex;
	}
	public synchronized void setSex(String sex) {
		this.sex = sex;
	}
	
	@Override
	public Object clone() throws CloneNotSupportedException {
		AttendanceReport adr = new AttendanceReport();
		adr.date= this.date;
		adr.userId=this.userId;
		adr.userName=this.userName;
		adr.normalHours=this.normalHours;
		adr.payloadHours=this.payloadHours;
		adr.leaveHours=this.leaveHours;
		adr.serviceName=this.serviceName;
		adr.sex=this.sex;
		adr.lateHits=this.lateHits;
		adr.leaveMap= new HashMap<String,BigDecimal>();
		adr.leaveMap.putAll(this.leaveMap);
		return adr;
	}
	public synchronized int getLateHits() {
		return lateHits;
	}
	public synchronized void setLateHits(int lateHits) {
		this.lateHits = lateHits;
	}
}
